Editor.DeckClose = function () {
	var figClose;
	var shape;
	var impl;
	return {
		init: function (s) {
			shape = s;
			impl = shape.getImplementation();
		},
		remove: function () {
			figClose.remove();
			delete figClose;
		},
		draw: function () {
			figClose = Editor.STATE.CANVAS.path(Editor.CONFIG.FIGCLOSE_PATH).attr(Editor.CONFIG.FIGCLOSE_ATTR);
			figClose.translate(shape.getWidth() - Editor.CONFIG.FIGCLOSE_DELTA_X, Editor.CONFIG.FIGCLOSE_DELTA_Y);
			figClose.mouseover(shape.getDeckClose().mouseover);
			figClose.mouseout(shape.getDeckClose().mouseout);
			figClose.click(shape.getDeckClose().click);
			figClose.toFront();
		},
		redraw: function () {
			figClose.translate(-figClose.getBBox().x, -figClose.getBBox().y);
			figClose.translate(shape.getX(), shape.getY());
			figClose.translate(shape.getWidth() - Editor.CONFIG.FIGCLOSE_DELTA_X, Editor.CONFIG.FIGCLOSE_DELTA_Y);
		},
		mouseover: function () {
			if (!Editor.Util.isDragging()) {
				figClose.attr(Editor.CONFIG.VISIBLE_ATTR);
			}
		},
		mouseout: function () {
			if (!Editor.Util.isDragging()) {
				figClose.attr(Editor.CONFIG.UNVISIBLE_ATTR);
			}
		},
		click: function () {
			impl.remove();
		},
		translate: function (deltaX, deltaY) {
			figClose.translate(deltaX, deltaY);
		},
		toFront: function () {
			figClose.toFront();
		}
	}
}
